package com.ruoyi.web.controller.teacher;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.BasisCaseLoadingTask;
import com.ruoyi.domain.BasisEquipmentInformationv;
import com.ruoyi.domain.BasisUnicom;
import com.ruoyi.service.IBasisCaseLoadingTaskService;
import com.ruoyi.service.IBasisEquipmentInformationvService;
import com.ruoyi.service.IBasisUnicomService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 展示联通Controller
 * 
 * @author wangzebing
 * @date 2025-06-25
 */
@RestController
@RequestMapping("/unicom")
public class BasisUnicomController extends BaseController
{
    @Autowired
    private IBasisUnicomService basisUnicomService;

    @Autowired
    private IBasisCaseLoadingTaskService basisCaseLoadingTaskService;

    @Autowired
    private IBasisEquipmentInformationvService basisEquipmentInformationvService;

    /**
     * 查询展示联通列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BasisUnicom basisUnicom)
    {
        startPage();
        List<BasisUnicom> list = basisUnicomService.selectBasisUnicomList(basisUnicom);
        return getDataTable(list);
    }

    /**
     * 导出展示联通列表
     */
    @Log(title = "展示联通", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BasisUnicom basisUnicom)
    {
        List<BasisUnicom> list = basisUnicomService.selectBasisUnicomList(basisUnicom);
        ExcelUtil<BasisUnicom> util = new ExcelUtil<BasisUnicom>(BasisUnicom.class);
        util.exportExcel(response, list, "展示联通数据");
    }

    /**
     * 获取展示联通详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(basisUnicomService.selectBasisUnicomById(id));
    }

    /**
     * 新增展示联通
     */
    @Log(title = "展示联通", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BasisUnicom basisUnicom)
    {
        return toAjax(basisUnicomService.insertBasisUnicom(basisUnicom));
    }

    /**
     * 修改展示联通
     */
    @Log(title = "展示联通", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BasisUnicom basisUnicom)
    {
        return toAjax(basisUnicomService.updateBasisUnicom(basisUnicom));
    }

    /**
     * 删除展示联通
     */
    @Log(title = "展示联通", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(basisUnicomService.deleteBasisUnicomByIds(ids));
    }


    @GetMapping(value = "/deleteBasisUnicomByLoadingId")
    public AjaxResult deleteBasisUnicomByLoadingId(String loadingId)
    {
        return success(basisUnicomService.deleteBasisUnicomByLoadingId(loadingId));
    }


    @GetMapping(value = "/selectBasisUnicomByLoadingId")
    public AjaxResult selectBasisUnicomByLoadingId(String loadingId)
    {
        return success(basisUnicomService.selectBasisUnicomByLoadingId(loadingId));
    }
}
